package esmp.jtt808.model.terminal;

import common.utils.DataPackUtil;
import esmp.jtt808.model.Decoder;

/**
 * Created by dave on 18-7-20 下午2:15.
 * 终端通用应答消息体，0x0001
 */
public class TerminalCommonResp implements Decoder<TerminalCommonResp> {
    private int platSequenceNo; // 平台消息流水号
    private int platMsgId;      // 平台消息ID，平台命令号
    private int result;         // 0：成功／确认，1：失败，2：消息有误，3：不支持

    @Override
    public TerminalCommonResp decode(byte[] bytes, int start, int end) {
        platSequenceNo = DataPackUtil.readWord(bytes, start);
        platMsgId = DataPackUtil.readWord(bytes, start + 2);
        result = bytes[start + 4];
        return this;
    }

    public int getPlatSequenceNo() {
        return platSequenceNo;
    }

    public void setPlatSequenceNo(int platSequenceNo) {
        this.platSequenceNo = platSequenceNo;
    }

    public int getPlatMsgId() {
        return platMsgId;
    }

    public void setPlatMsgId(int platMsgId) {
        this.platMsgId = platMsgId;
    }

    public int getResult() {
        return result;
    }

    public void setResult(int result) {
        this.result = result;
    }
}
